/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package argtrust.logic;

import java.io.PrintStream;
import aima.core.logic.fol.parsing.ast.Sentence;

/**
 * Inference node of a reasoning network.
 * @author Yuqing Tang
 */
public abstract class InferenceNode {

    private Sentence origGoal;

    @Override
    public int hashCode() {
        if (origGoal != null) {
            return origGoal.hashCode();
        } else {
            return 17;
        }
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }


        final InferenceNode rhs = (InferenceNode) obj;
        boolean res = true;
        if (origGoal != null) {
            res = res && origGoal.equals(rhs.origGoal);
        } else {
            res = res && rhs.origGoal == null;
        }

        return res;

    }

    InferenceNode() {
    }

    InferenceNode(InferenceNode orig) {
        origGoal = orig.origGoal;
    }

    void setOrigGoal(Sentence orig_goal) {
        origGoal = orig_goal;
    }

    Sentence getOrigGoal() {
        return origGoal;
    }

    abstract public void debug_print(PrintStream out);
//    {
//        out.println("in InferenceNode::debug_print");
//    }
    //---------------------------------------
    ///For dynamic programming usage.
    boolean isMark = false;

    public boolean isMark() {
        return isMark;
    }

    public void mark() {
        this.isMark = true;
    }

    public void unmark() {
        this.isMark = false;
    }

    public void unmarkHierarchy() {
        unmark();

    }
    //---------------------------------------
}
